var workCountID = GetQueryString("id");
var sentMessage = {
    "requestType": "initBaseInfoFromWorkCount",
    "wc_id": workCountID
};
var workCountData;
$.ajax({
    url: '/task/newTecCard',
    type: 'post',
    data: sentMessage,
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            workCountData = data;
        }

    },
    error: function (data, status) {
        if (status == 'error') {
            alert("你的网络有问题！");
        }
    }
});
var taskData;
sentMessage = {
    "requestType": "initBaseInfoFromTask",
    "task_id": workCountData.wc_tid
};
$.ajax({
    url: '/task/newTecCard',
    type: 'post',
    data: sentMessage,
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            taskData = data;
        }

    },
    error: function (data, status) {
        if (status == 'error') {
            alert("你的网络有问题！");
        }
    }
});
document.getElementById("task_product").value = taskData.task_product;//产品名称
document.getElementById("task_pname").value = taskData.task_pname;//项目名称
document.getElementById("task_opportunity").value = taskData.task_opportunity;//检测时机
document.getElementById("wc_pipeName").value = workCountData.wc_pipeName;//管线名称
document.getElementById('wc_type').value = workCountData.wc_type;//坡口形式
document.getElementById('wc_weldM').value = workCountData.wc_weldM;//焊接方法
document.getElementById('wc_texture').value = workCountData.wc_texture;//材质

document.getElementById("wc_spec").value = workCountData.wc_spec;//工件规格
document.getElementById("wc_scale").value = workCountData.wc_scale;//检测比例
document.getElementById("task_standard").value = taskData.task_standard;//检测标准
document.getElementById("wc_qua").value = workCountData.wc_qua;//合格级别
function OnCommit() {
    var date = new Date();
    sentMessage = {
        "tech_version": document.getElementById("tech_version").value,
        "tech_pid": taskData.task_pid,
        "tech_tid": workCountData.wc_tid,
        "tech_wcid": workCountID,
        "tech_screen": document.getElementById("tech_screen").value,
        "tech_filmBrand": document.getElementById("tech_filmBrand").value,
        "tech_devTime": document.getElementById("tech_devTime").value,
        "tech_devT": document.getElementById("tech_devT").value,
        "tech_ray": document.getElementById("tech_ray").value,
        "tech_focus": document.getElementById("tech_focus").value,
        "tech_IQIV": document.getElementById("tech_IQIV").value,
        "tech_filmV": document.getElementById("tech_filmV").value,
        "tech_devCondition": document.getElementById("tech_devCondition").value,
        "tech_liquor": document.getElementById("tech_liquor").value,
        "tech_focalDis": document.getElementById("tech_focalDis").value,
        "tech_seg": document.getElementById("tech_seg").value,
        "tech_tranLen": document.getElementById("tech_tranLen").value,
        "tech_IQISen": document.getElementById("tech_IQISen").value,
        "tech_V": document.getElementById("tech_V").value,
        "tech_time": document.getElementById("tech_time").value,
        "tech_tranType": document.getElementById("tech_tranType").value,
        "tech_date": date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate(),
        "tech_uid": user.user_id,
        "requestType": "commitTechTable"
    };
    console.log(JSON.stringify(sentMessage));
    $.ajax({
        url: '/task/newTecCard',
        type: 'post',
        data: sentMessage,
        async: false,
        success: function (data, status) {
            if (status == 'success') {
                alert("提交成功");
                history.back();
            }

        },
        error: function (data, status) {
            if (status == 'error') {
                alert("你的网络有问题！");
            }
        }
    });
}